import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:largefriends/entity/entities/lf_user_entity.dart';
import 'package:largefriends/res/lf_color.dart';
import 'package:largefriends/res/lf_double_ext.dart';
import 'package:largefriends/res/lf_fonts.dart';
import 'package:largefriends/res/lf_text_style.dart';
import 'package:largefriends/res/lf_widget_ext.dart';
import 'package:largefriends/res/strings/lf_strings.dart';
import 'package:largefriends/utils/lf_logger.dart';
import 'package:largefriends/widgets/custom_cache_image.dart';

class LfBlockedMembersWidget extends StatelessWidget {
  const LfBlockedMembersWidget({
    super.key,
    required this.userEntity,
    required this.click,
  });
  final LfUserEntity userEntity;
  final Function click;
  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.symmetric(vertical: 6.h),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          CustomCacheImage(
            imageUrl: userEntity.avatar,
            fit: BoxFit.cover,
            borderRadius: 10.r.radius,
            height: 60.r,
            width: 60.r,
          ),
          8.w.sbw,
          Expanded(
              child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                userEntity.username.toUpperCase(),
                maxLines: 1,
                overflow: TextOverflow.ellipsis,
                style: lfTextStyle(sp: 15.sp, fontFamily: fontMedium),
              ),
            ],
          )),
          8.w.sbw,
          InkWell(
            child: Container(
              decoration:
                  BoxDecoration(color: colorFF007F, borderRadius: 4.r.radius),
              padding: EdgeInsets.symmetric(vertical: 2.h, horizontal: 5.w),
              child: Text(
                'Unblock',
                style: lfTextStyle(
                    sp: 15.sp, fontFamily: fontMedium, color: colorFEFEFE),
              ),
            ),
            onTap: () {
              click.call();
            },
          )
        ],
      ),
    );
  }

  Widget _header() {
    return SizedBox(
      width: ScreenUtil().screenWidth,
      height: ScreenUtil().screenWidth,
      child: Stack(
        children: [
          Positioned(
              child: SizedBox(
            width: ScreenUtil().screenWidth,
            child: CustomCacheImage(
              imageUrl: userEntity.avatar,
              fit: BoxFit.cover,
              borderRadius: BorderRadius.only(
                  topLeft: Radius.circular(10.r),
                  topRight: Radius.circular(10.r)),
              height: ScreenUtil().screenWidth,
              width: ScreenUtil().screenWidth,
            ),
          )),
          Align(
              alignment: Alignment.bottomLeft,
              child: Container(
                decoration: BoxDecoration(
                    gradient: LinearGradient(colors: [
                  Colors.transparent,
                  color210215.withAlpha(50),
                ], begin: Alignment.topCenter, end: Alignment.bottomCenter)),
                width: ScreenUtil().screenWidth,
                height: 100.h,
              )),
          Align(
              alignment: Alignment.bottomLeft,
              child: Container(
                padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 10.h),
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.end,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(
                      userEntity.username.toUpperCase(),
                      style: lfTextStyle(
                          sp: 15.sp,
                          color: colorFEFEFE,
                          fontFamily: fontMedium),
                    ),
                    userEntity.getGenderWithAgeLiveIn().isNotEmpty
                        ? Text(
                            userEntity.getGenderWithAgeLiveIn(),
                            style: lfTextStyle(
                                sp: 13.sp,
                                color: colorFEFEFE,
                                fontFamily: fontRegular),
                            overflow: TextOverflow.ellipsis,
                          )
                        : empty
                  ],
                ),
              ))
        ],
      ),
    );
  }

  Widget _footer() {
    return SizedBox(
      width: ScreenUtil().screenWidth,
      height: 60.h,
      child: Center(
          child: InkWell(
        onTap: () {
          click.call();
        },
        child: Text(
          strUnblock.tr,
          style:
              lfTextStyle(sp: 15.sp, color: color210215, fontFamily: fontBold),
        ),
      )),
    );
  }
}
